//
//  SimpleStorage.m
//  aloqa
//
//  Created by mkoo sun on 12-8-24.
//  Copyright (c) 2012年 exodus. All rights reserved.
//

#import "SimpleStorage.h"
#import "Storage.h"
#import "Config.h"

@implementation SimpleStorage

//-------------------------------------------------------------------------------------------
- (id)initWithName:(NSString*)name
{
    self = [super init];
    if (self) {
        storageUtil = [[Storage alloc]initWithName: name];
    }
    return self;
}

- (void)dealloc
{
    [storageUtil release];
    storageUtil = nil;    
    [super dealloc];
}

//-------------------------------------------------------------------------------------------
-(void)clear
{
    [storageUtil ClearAll];
}

//-------------------------------------------------------------------------------------------
-(NSString*)get:(NSString*)key
{
    return [storageUtil Get:key default:Nil];
}

//-------------------------------------------------------------------------------------------
-(NSString*)getWithDefault:(NSString*)key default:(NSString*)defaultValue
{
    return [storageUtil Get:key default:defaultValue];
}

//-------------------------------------------------------------------------------------------
-(void)put:(NSString*)key value:(NSString*)value
{
    [storageUtil Set:key value:value];
}

//-------------------------------------------------------------------------------------------
-(void)begin
{}

//-------------------------------------------------------------------------------------------
-(void)rollback
{}

//-------------------------------------------------------------------------------------------
-(void)commit
{
    [storageUtil Commit];
}

//-------------------------------------------------------------------------------------------
-(void)close
{
}

@end
